<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="../css/left-menu-style.css" />
		<link href="http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
		<script src="http://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
		<script src="http://cdn.bootcss.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
	</head>

	<body>
		<div class="container-fluid">
			<div class="row">
				<div class="col-md-2">
					<ul id="main-nav" class="nav nav-tabs nav-stacked">
						<li class="active">
							<a href="#">
								<i class="glyphicon glyphicon-th-large"></i>首页
							</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
		</div>
	</body>
	
	<script>
		/**
		 * 获取当前项目名
		 */
		function getPath(){
			var pathName=window.document.location.pathname;
			var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1); 
			return projectName;
		}
		$(function(){
			$.ajax({
			   type: "POST",
			   url: getPath()+"/employee",
			   data: ({
				    'type':'leftMenuAppend',
			   }),
			   dataType:'json',
			   success: function(jsonData){
				  $(jsonData.data).each(function(index,data){
				  	
				  	var a = $('<a href="#left-one-menu'+data.menuId+'" class="nav-header collapsed" data-toggle="collapse"><i class="glyphicon glyphicon-list"></i>&nbsp;&nbsp;'+data.menuName+'</a>');
				  	var span = $('<span class="pull-right glyphicon glyphicon-chevron-down"></span>');
				  	a.append(span);
				  	
				  	var oneMenu = $('<ul id="left-one-menu'+data.menuId+'" class="nav nav-list collapse secondmenu"></ul>');
				  	var oneMenu_li = $('<li></li>');
				  	var name = data.menuName;
				  	name = name.substring(0,2);
				  	var oneMenu_a = $('<a href="#left-two-menu'+data.menuId+'" class="nav-header collapsed" data-toggle="collapse"><i class="glyphicon glyphicon-list-alt"></i>&nbsp;&nbsp;'+name+'维护</a>');
				  	var oneMenu_a_span = $('<span class="pull-right glyphicon glyphicon-chevron-down"></span>');
				  	oneMenu_a.append(oneMenu_a_span);
				  	
				  	var twoMenu = $('<ul id="left-two-menu'+data.menuId+'" class="nav nav-list collapse secondmenu"></ul>');
				  	var twoMenu_a = $('<li><a style="padding-left: 30px;" href="'+data.menuUrl+'" target="content"><i class="glyphicon glyphicon-transfer"></i>&nbsp;&nbsp;'+data.chrildentName+'</a></li>');
				  	twoMenu.append(twoMenu_a);
				  	oneMenu_li.append(oneMenu_a);
				  	oneMenu_li.append(twoMenu);
				  	oneMenu.append(oneMenu_li);
				  	
				  	var li = $('<li></li>');
				  	li.append(a);
				  	li.append(oneMenu);
				  	$('#main-nav').append(li);
				  });
			   }
			});
		});
	</script>

</html>